/*
 * Android Runner is a multiplayer GPS game fully written by Xurxo Mendez Perez
 * 
 * Copyright (C) 2009 Xurxo Mendez Perez
 *   
 * This file is part of Android Runner.
 * 
 * Android Runner is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * Android Runner is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with Android Runner.  If not, see <http://www.gnu.org/licenses/>.
 */

package es.sonxurxo.androidrunner.model.service.game.to;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;

/**
 * 
 * @author "Xurxo Mendez Perez"
 *
 */
public class FinishedGameTO {

	private long gameId;
	private String city;
	private Calendar startDate;
	private List<String> playerLogins = new ArrayList<String>();
	private List<Integer> points = new ArrayList<Integer>();
	private List<Integer> itemsCaughted = new ArrayList<Integer>();
	private List<Integer> positions = new ArrayList<Integer>();
	
	public FinishedGameTO() {}

	public FinishedGameTO(long gameId) {
		this.gameId = gameId;
	}
	
	public FinishedGameTO(List<String> playerNames, List<Integer> points,
			List<Integer> itemsCaughted, long gameId, List<Integer> positions) {
		super();
		this.playerLogins = playerNames;
		this.points = points;
		this.gameId = gameId;
		this.itemsCaughted = itemsCaughted;
		this.positions = positions;
	}

	public List<Integer> getPositions() {
		return positions;
	}

	public void setPositions(List<Integer> positions) {
		this.positions = positions;
	}

	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	public Calendar getStartDate() {
		return startDate;
	}

	public void setStartDate(Calendar startDate) {
		this.startDate = startDate;
	}

	public List<Integer> getItemsCaughted() {
		return itemsCaughted;
	}

	public void setItemsCaughted(List<Integer> itemsCaughted) {
		this.itemsCaughted = itemsCaughted;
	}

	public List<String> getPlayerLogins() {
		return playerLogins;
	}

	public void setPlayerLogins(List<String> playerLogins) {
		this.playerLogins = playerLogins;
	}

	public List<Integer> getPoints() {
		return points;
	}

	public void setPoints(List<Integer> points) {
		this.points = points;
	}
	
	public void addLine(String playerName, int points, int itemsCaughted, int position) {
		this.playerLogins.add(playerName);
		this.points.add(points);
		this.itemsCaughted.add(itemsCaughted);
		this.positions.add(position);
	}

	public long getGameId() {
		return gameId;
	}

	public void setGameId(long gameId) {
		this.gameId = gameId;
	}
	
	public String toString() {
		String result = new String("Game " + this.gameId + "\n------\n");
		for (int i=0;i<this.playerLogins.size();i++)
			result = result.concat(i+1 + "\t" + this.playerLogins.get(i) + 
					"\t" + this.points.get(i) + "\n");
		return result;
	}
}
